package android.slc.appbase.ui

import android.slc.box.core.virtual_android.Bundle
import android.slc.box.core.ui.BaseEmbeddedWindowView
import android.slc.box.core.ui.BaseEmbeddedWindowViewModel
import de.saxsys.mvvmfx.FxmlView
import de.saxsys.mvvmfx.Scope
import de.saxsys.mvvmfx.ViewModel
import javafx.scene.Parent

open class AppEmbeddedWindowView<VM : BaseEmbeddedWindowViewModel<*>> : BaseEmbeddedWindowView<VM>() {

    override fun addView(contentView: Parent) {
        super.addView(boxContentPane, contentView)
    }

    fun <ViewType : FxmlView<out ViewModelType>?, ViewModelType : ViewModel?> launcherWindow(
        viewClass: Class<ViewType>?,
        appStageLauncherConfig: AppStageLauncherConfig,
        vararg scopes: Scope?
    ) {
        this.launcherWindow(
            viewClass,
            null,
            appStageLauncherConfig,
            *scopes
        )
    }

    fun <ViewType : FxmlView<out ViewModelType>?, ViewModelType : ViewModel?> launcherWindow(
        viewClass: Class<ViewType>?,
        bundle: Bundle?,
        appStageLauncherConfig: AppStageLauncherConfig,
        vararg scopes: Scope?
    ) {
        this.launcherWindow(
            appStageLauncherConfig.createCurrentStage(),
            viewClass,
            bundle,
            appStageLauncherConfig,
            *scopes
        )
    }
}
